package com.hbnu.zhouxunfa;


import java.io.*;
import java.net.Socket;

public class MultePicClient {
    public static void main(String[] args) {
        try {
            Socket socket = new Socket("127.0.0.1",8080);
            OutputStream os = socket.getOutputStream();
            BufferedOutputStream bos = new BufferedOutputStream(os);
            FileInputStream fis = new FileInputStream("E:\\CODE\\develop\\Websocaket\\clientdir\\001.jpg");
            BufferedInputStream bis = new BufferedInputStream(fis);
            int len;
            byte[] bytes = new byte[1024];
            System.out.println("图片上传中...");
            while ((len = bis.read(bytes))!=-1){
                bos.write(bytes,0,len);
            }
            System.out.println("图片上传完毕");
            socket.shutdownOutput();


            //接收回显数据
            InputStream is = socket.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader bf = new BufferedReader(isr);
            bf.readLine();

            socket.close();

        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
